package br.edu.ufcg.dsc.ia1.jt;

import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.neuroph.core.NeuralNetwork;
import org.neuroph.nnet.MultiLayerPerceptron;

import br.edu.ufcg.dsc.ia1.jt.core.Train;
import br.edu.ufcg.dsc.ia1.jt.util.RasterAsLine;

public class MainTests {
	
	public static void main(String[] args) {
	}
	
	public static void main1(String[] args) {
		File input = new File(args[0]);
		try {
			BufferedImage img = ImageIO.read(input);
			RasterAsLine raster = new RasterAsLine(img);
			for(int y = 0; y < img.getHeight(); y++) {
				for(int x = 0; x < img.getWidth(); x++) {
					System.out.print(raster.pixelAt(y * img.getWidth() + x));
				}
				System.out.println();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static void main2(String[] args) {
		File input = new File(args[0]);
		try {
			BufferedImage img = ImageIO.read(input);
			Raster raster = img.getData();
			for(int y = 0; y < img.getHeight(); y++) {
				for(int x = 0; x < img.getWidth(); x++) {
					System.out.print(raster.getPixel(x, y, new int[1])[0] == 1 ? " " : '.');
				}
				System.out.println();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static void main3(String[] args) {
		File input = new File(args[0]);
		int SIZE = 20, NORMAL = 1;
		try {
			BufferedImage img = ImageIO.read(input);
			RasterAsLine raster = new RasterAsLine(img, img.getHeight(), SIZE, NORMAL);
			int i = 0;
			for(int y = 0; y < SIZE; y++) {
				for(int x = 0; x < SIZE; x++) {
					System.out.print(raster.pixelAt(i++));
				}
				System.out.println();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	

}
